<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>九九乘法表</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Arial, sans-serif;
            background-color: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }

        .multiplication-table-container {
            width: 100%;
            max-width: 800px;
            padding: 20px;
        }

        #multiplication-table {
            display: inline-block;
        }

        .multiplication-cell {
            display: inline-block;
            width: 80px; /* 统一单元格宽度 */
            padding: 8px 0;
            border: 1px solid blue;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            background-color: #ffffff;
            font-size: 14px;
            color: #333;
        }

        .multiplication-cell:hover {
            background-color: blue;
            color: white;
            transform: scale(1.05);
        }
    </style>
</head>
<body>
    <div class="multiplication-table-container">
        <div id="multiplication-table"></div>
    </div>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const tableContainer = document.getElementById('multiplication-table');
            
            for (let i = 1; i <= 9; i++) {
                for (let j = 1; j <= i; j++) {
                    const cell = document.createElement('div');
                    cell.className = 'multiplication-cell';
                    cell.textContent = `${i} × ${j} = ${i * j}`;
                    cell.addEventListener('mouseenter', function() {
                        this.style.backgroundColor = 'blue';
                        this.style.color = 'white';
                        this.style.transform = 'scale(1.05)';
                    });
                    cell.addEventListener('mouseleave', function() {
                        this.style.backgroundColor = '#ffffff';
                        this.style.color = '#333';
                        this.style.transform = 'scale(1)';
                    });
                    tableContainer.appendChild(cell);
                }
                tableContainer.appendChild(document.createElement('br'));
            }
        });
    </script>
</body>
</html>